#include "MD5toURL.h"
#include <map>
#include <string>
#include <fstream>

using namespace std;
map<string,string> MD5toURL::dic;

MD5toURL::MD5toURL()
{
}

MD5toURL::~MD5toURL()
{
}

void MD5toURL::loadMap(string file)
{
	ifstream in;
	in.open(file.c_str(), ios::in);
	string MD5;
	string url;
	if(in.is_open())
	{
		while(!in.eof())
		{
			in >> MD5;
			in >> url;
			dic[MD5]=url;
		}
		in.close();
	}
}

string MD5toURL::translate(string MD5)
{
	if(dic.find(MD5)!= dic.end())
		return dic[MD5];
	else
		return "Call Huston";
}